//
//  ChoseParkViewController.m
//  test
//
//  Created by 刘杨 on 14-10-9.
//  Copyright (c) 2014年 刘杨. All rights reserved.
//

#import "ChoseParkViewController.h"
#import "TimeSegSettingViewController.h"
#import "AppDelegate.h"

@interface ChoseParkViewController ()

@end

@implementation ChoseParkViewController
@synthesize message ;
@synthesize texts ;
@synthesize details ;
@synthesize nodeLabel ;
- (void)viewDidLoad {
    NSLog(@"333---");
    NSArray * texts_ = [[NSArray alloc] initWithObjects:@"南海电大停车场",@"出入境检验检疫局",nil];
     NSArray * details_ = [[NSArray alloc] initWithObjects:@"佛山市桂城区南海电大停车场",@"佛山市南海区出入境检验检疫局",nil];
    self.texts = texts_;
    self.details = details_;
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
-(void) viewDidAppear:(BOOL)animated{
    NSLog(@"5555---");
    //nodeLabel.text = message;
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.texts count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"ChosePark");
    static NSString *SimpleCellIdentifier = @"SimpleCellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleCellIdentifier];
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                      reuseIdentifier:SimpleCellIdentifier];
        
    }
    NSUInteger row = [indexPath row];
    cell.textLabel.text = [self.texts objectAtIndex:row];
    cell.detailTextLabel.text = [self.details objectAtIndex:row];
    NSLog(@"2222");
   // UIColor *testColor1= [UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1];
    cell.textLabel.textColor = [UIColor orangeColor];
    [cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
    return cell;
}


/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

-(void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"asasasas");
    UIStoryboard *mainStoryboard =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
    TimeSegSettingViewController * timesegSetting = [mainStoryboard instantiateViewControllerWithIdentifier:@"TimeSegSettingViewController"];
    timesegSetting.modalPresentationStyle=UIModalPresentationFormSheet;
    timesegSetting.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
    AppDelegate * delegate = [[UIApplication sharedApplication] delegate];
    if (delegate.navigationController == nil) {
        NSLog(@"navigationController is nil");
        
    }
    NSLog(@"yayayayayaya");
    [delegate.navigationController pushViewController:timesegSetting animated:YES];
}


@end
